package com.example.demo.customer;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;

@Entity
@Table
public class Customer {


    public Customer(){

    }
    public Customer(Long id, String name, String password, String email) {
        this.password = password;
        this.id = id;
        this.name = name;
        this.email = email;
    }
    @Id
    private  Long id;
    @NotBlank
    private  String name;
    @NotBlank
    @JsonProperty(access =JsonProperty.Access.WRITE_ONLY)
    private  String password;

    public String getEmail() {
        return email;
    }
    @NotBlank
    @Email
    private    String email;
    @JsonProperty("customerId")
    public Long getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public Long getCustomerId(){
            return id;
    }
    @JsonIgnore
public String getPassword(){
          return password;
}

    @Override
    public String toString() {
        return "Customer{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", password='" + password + '\'' +
                ", email='" + email + '\'' +
                '}';
    }
}

